Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

JavaScript Forum


You are currently viewing our JavaScript Forum as a guest. Please register to participate.
Login



Reply
Changing imges using JS function.......
Old 03-12-2010, 06:12 AM Changing imges using JS function.......
Isabella_Smith's Avatar
Ultra Talker

Posts: 285
Trades: 0
Hi,

I am designing a web page using js to change images...........but It seems not to be working.........please help me to make it work.....

here's the function.....

HTML Code:
<script language="JavaScript">
    
function random_imglink()
{

var myimages=new Array()
 myimages[0]='../image/img1.gif';
 myimages[1]='../image/img2.gif';
 myimages[2]='../image/img3.gif';

var imagelinks=new Array()
 imagelinks[0]='../link1.php';
 imagelinks[1]='../link2.php';
 imagelinks[2]='../link3.php';

 var mytext=new Array()
 mytext[0]='txt1'
 mytext[1]='txt2'
 mytext[2]='txt3'

var myheight=new Array()
myheight[0]=630
myheight[1]=469
myheight[2]=590

var mywidth=new Array()
mywidth[0]=680
mywidth[1]=583
mywidth[2]=582


 var ry=Math.floor(Math.random()*myimages.length);

 var str = "<a href=\"javascript:void(0); var aa=window.open('"+imagelinks[ry]+"','DD','width="+mywidth[ry]+",height="+myheight[ry]+",left=30,top=25,scrollbars=yes,resizable=no');\" class='popsearchfont'><img src='"+myimages[ry]+"' alt='"+mytext[ry]+"' style='border: 0px;' /></a>";
 document.getElementById('jxdiv').innerHTML=str;
 timedCount();
 }

 var c=0
 var t
 function timedCount()
 {
 t=setTimeout("random_imglink()",4000);
 }
</script>

<div id="ajaxDiv">
</div>
__________________

Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE



Please login or register to view this content. Registration is FREE
buy all indian salwar Kameez, Sarees and clothes
Isabella_Smith is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 03-12-2010, 06:41 AM Re: Changing imges using JS function.......
chrishirst's Avatar
Missing! presumed drunk.

Posts: 42,383
Name: Chris Hirst
Location: Blackpool. UK
Trades: 0
Define "not working"
__________________
Chris. ->>
Please login or register to view this content. Registration is FREE
<<-

A foolish consistency is the hobgoblin of little minds
Thought for today:- Is SEO the only industry where all the cowboys are Indians?
chrishirst is online now
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Old 03-12-2010, 06:55 AM Re: Changing imges using JS function.......
Isabella_Smith's Avatar
Ultra Talker

Posts: 285
Trades: 0
Defination not working: It means At the time of running its not changing images...and text.....as you can see for what it has been designed...
__________________

Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE



Please login or register to view this content. Registration is FREE
buy all indian salwar Kameez, Sarees and clothes
Isabella_Smith is offline
Reply With Quote
View Public Profile
 
Old 03-12-2010, 07:01 AM Re: Changing imges using JS function.......
chrishirst's Avatar
Missing! presumed drunk.

Posts: 42,383
Name: Chris Hirst
Location: Blackpool. UK
Trades: 0
Actually ALL we can see is code. Which we cannot recreate to test because we DO NOT have your images.

WE also DO NOT know your folder structure so have no idea whether the path to the images is correct. AND we cannot tell if using the ../ syntax for the path is correct or not.

Consequently, we will simply be guessing at what the problems may be on YOUR server.
__________________
Chris. ->>
Please login or register to view this content. Registration is FREE
<<-

A foolish consistency is the hobgoblin of little minds
Thought for today:- Is SEO the only industry where all the cowboys are Indians?
chrishirst is online now
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Old 03-12-2010, 07:11 AM Re: Changing imges using JS function.......
Isabella_Smith's Avatar
Ultra Talker

Posts: 285
Trades: 0
In short ....................code is correct????

Its working now..............
__________________

Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE



Please login or register to view this content. Registration is FREE
buy all indian salwar Kameez, Sarees and clothes

Last edited by Isabella_Smith; 03-12-2010 at 07:24 AM..
Isabella_Smith is offline
Reply With Quote
View Public Profile
 
Old 03-12-2010, 07:31 AM Re: Changing imges using JS function.......
chrishirst's Avatar
Missing! presumed drunk.

Posts: 42,383
Name: Chris Hirst
Location: Blackpool. UK
Trades: 0
You are missing the point

I already have random image code that works http://www.modtalk.co.uk/_site/code/.../random-image/

It is not on a timer, sure, but that is a very simple addition to the code that would take me abut 3 minutes including uploading the files back to the server.

NOW the problem is ON YOUR SERVER, NOT mine.

we need to see WHAT THE ACTUAL PROBLEM IS which we will ONLY able to be 100% accurate about by seeing the code RUNNING in situ, ON YOUR SERVER with YOUR IMAGES in the location YOUR CODE expects them to be.

Recreating your code with other images on a different server with different folder structures may not actually show what the problem is!!!!!
__________________
Chris. ->>
Please login or register to view this content. Registration is FREE
<<-

A foolish consistency is the hobgoblin of little minds
Thought for today:- Is SEO the only industry where all the cowboys are Indians?
chrishirst is online now
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Old 03-12-2010, 07:54 AM Re: Changing imges using JS function.......
Isabella_Smith's Avatar
Ultra Talker

Posts: 285
Trades: 0
Actually there was a really silly mistake I did..............So....thanks a ton! for your help and consideration..............
__________________

Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE



Please login or register to view this content. Registration is FREE
buy all indian salwar Kameez, Sarees and clothes
Isabella_Smith is offline
Reply With Quote
View Public Profile
 
Old 03-12-2010, 11:02 AM Re: Changing imges using JS function.......
Andy Pugh's Avatar
Extreme Talker

Posts: 203
Name: Andy
Location: N.Ireland
Trades: 0
My word Chris, she was only asking for a bit of help... seriously man..
__________________

Please login or register to view this content. Registration is FREE
Andy Pugh is offline
Reply With Quote
View Public Profile
 
Old 03-12-2010, 11:46 AM Re: Changing imges using JS function.......
chrishirst's Avatar
Missing! presumed drunk.

Posts: 42,383
Name: Chris Hirst
Location: Blackpool. UK
Trades: 0
Certainly, but we seem to go through the same rigmarole every time.

When all it would take is to post a URI where we could see the code working or not.
__________________
Chris. ->>
Please login or register to view this content. Registration is FREE
<<-

A foolish consistency is the hobgoblin of little minds
Thought for today:- Is SEO the only industry where all the cowboys are Indians?
chrishirst is online now
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Reply     « Reply to Changing imges using JS function.......
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

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

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.28858 seconds with 12 queries