JavaScript Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 
Go Back   Dev Articles Community ForumsProgrammingJavaScript Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
  #1  
Old June 27th, 2004, 02:00 AM
Brian Zero Brian Zero is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jun 2004
Posts: 3 Brian Zero User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Cool I need to replace those ugly buttons with graphics

Hello All,

I am having some difficulty in replacing simple buttons with graphics. Whenever I do this, it disables the java function altogether. The code looks right, but I dont know...

Here is where the problem is. The input needs to be changed to "image", right?? Maybe somebody can whip up a sample of what the code should look like if it were to point to an image src for the buttons. I have totally screwed it up...

Thanks,
Brian
Code:
var current = 0;
function initArray() {
this.length = initArray.arguments.length;
  for (var i = 0; i < this.length; i++) {
  this[i] = initArray.arguments[i];
  }
}
var picz = new initArray(
"images/1.jpg",
"images/2.jpg",
"images/3.jpg",
"images/4.jpg",
"images/5.jpg",
"images/6.jpg",
"images/7.jpg",
"images/8.jpg",
"images/9.jpg",
"images/10.jpg"
);
  document.write('<img name="jscriptimg" src="'+picz[0]+'">');
function checkIt(val) {
var goodnum = current+val;
if (goodnum < 0) ("You can't go any further back!");
else if (goodnum > picz.length-1) ("You can't go any further forward!");
else document.jscriptimg.src = picz[goodnum];
current = goodnum;
}
//-->
</script>
<br><input type="button" value="Back" onclick="checkIt(-1)"> <input type="button" value="Forward" onclick="checkIt(1)">
</center>
</form>

<body>
</body>
</html>

Reply With Quote
  #2  
Old June 27th, 2004, 05:42 PM
EiSa EiSa is offline
Contributing User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Sep 2002
Location: Norway
Posts: 184 EiSa User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 h 22 m 24 sec
Reputation Power: 7
You don't need that javascript, simply do like this:
<input alt="Back" type="image" src="/images/10.jpg" name="BackButton" />

But what are the purpose of the script you have? To move forward with javascript:
<a href="javascript:history.go(+1);"><img src="/images/forward_icon.gif" alt="Forward"></a>

To move back:
<a href="javascript:history.go(-1);"><img src="/images/back_icon.gif" alt="Back"></a>

Reply With Quote
  #3  
Old June 27th, 2004, 11:13 PM
Brian Zero Brian Zero is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jun 2004
Posts: 3 Brian Zero User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Yes, you are correct. The other part of the script in question is to nav back. The full function is backwards and forwards.

I will see if this fixes the problem that I have been encountering. From the look of it, your script is a simplified version of what I had. I will put it to work for me.

Thanks,
Brian

Reply With Quote
  #4  
Old June 28th, 2004, 01:23 AM
Brian Zero Brian Zero is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jun 2004
Posts: 3 Brian Zero User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Its still not fixed (link)

That script was for the backward and forward function for a browser. What I need is to replace those forward and backward buttons with graphics. Here is a simple example (link). You will understand once you see what I am talking about...

For some reason, when I try to do the graphical replacement, the javascript becomes disabled. Not sure why...

http://www.brianzero.com/test.htm

Brian

Reply With Quote
  #5  
Old June 28th, 2004, 02:18 AM
EiSa EiSa is offline
Contributing User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Sep 2002
Location: Norway
Posts: 184 EiSa User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 h 22 m 24 sec
Reputation Power: 7
Well, this should work:
<a href="javascript:checkIt(-1);"><img src="backwards_icon.gif" alt="Backward"></a> <a href="javascript:checkIt(1);"><img src="forward_icon.gif" alt="Forward"></a>

or this:
<img src="backwards_icon.gif" alt="Backward" onclick="checkIt(-1)"> <img src="forward_icon.gif" alt="Forward" onclick="checkIt(1)">

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsProgrammingJavaScript Development > I need to replace those ugly buttons with graphics


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 1 hosted by Hostway
Stay green...Green IT