Go Back   Free website templates > Web Template Help > JavaScript
User Name
Password
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read


Join now to share free website templates or post on the forum. If you have never been on a forum before read the FAQ. It's quick, easy and free to join!
Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 10-31-2008, 12:18 PM
Junior Member
 
Join Date: Oct 2008
Posts: 1
komrad is on a distinguished road
Default problem on javascript onclick event

Hello all,

I have this code in an iframe

<FORM><INPUT TYPE="BUTTON" VALUE="Go Back"
ONCLICK="history.go(-1)"></FORM>

it works fine but i need it to taget another iframe on the page and change that iframe and go back in its own iframe

Thanks in advance.
Reply With Quote
  #2 (permalink)  
Old 10-31-2008, 05:42 PM
ishkey's Avatar
Moderator
 
Join Date: Aug 2007
Location: North GA USA
Posts: 1,778
ishkey will become famous soon enough
Default

history - will only take you back from where you came from.
just change the code to suit your needs.
this will take you to the iframe you specify.
If you want it as a button, then use the form method.
Code:
 
<a href="http://www.totheiframe.com"
 onMouseOver="window.status='Back to The Iframe You Go'; 
 return true">Go Back</a>
I do not understand part 2 (change that iframe) and 3 (go back in its own iframe) of your question.
1 out of 3 is a start.
__________________

Consultant - Programmer - WebMaster
cleandeck - lawn mower undercoating
wilmargraphite - graphite lubricants
Reply With Quote
  #3 (permalink)  
Old 03-24-2009, 05:17 AM
Junior Member
 
Join Date: Mar 2009
Posts: 3
MH Vishal is on a distinguished road
Default

Thanks so much. It saved my bacon. I've been beating my head against this wall for a good part of this last week and thanks to the info I got here, I can now move on to something more productive and enjoyable.

The best solution for me was to insert
if (window.event) event.returnValue = false;
just before the "return false; "statement.

I understand the point you made about being reluctant to use browser specific code such as returnvalue, and I agree with that as a general principle. However, I think browser specific code is exactly the right and appropriate response to browser specific bugs.
Reply With Quote
  #4 (permalink)  
Old 04-14-2009, 03:40 AM
Member
 
Join Date: Apr 2009
Location: London, UK
Posts: 54
Osman is on a distinguished road
Default

if you give an iframe a name it becomes easy to target it

for example

<iframe id="if1" name="frame1" src="iframe1/index.html" frameborder=0></iframe>
alert(document.getElementById('if1').src) would give you 'iframe1/index.html'
<iframe id="if2" name="frame2" src="iframe2/index.html" frameborder=0></iframe>
alert(document.getElementById('if2').src) would give you 'iframe2/index.html'

<a href="http://www.google.com" target="frame1">Google in frame 1</a>
<a href="http://www.yahoo.com" target="frame2">Yahoo! in frame 2</a>

Click these two links,
alert(document.getElementById('if1').src) would give you 'http://www.google.com'
alert(document.getElementById('if2').src) would give you 'http://www.yahoo.com'

similarly, <a href="history.go(-1)" target=frame1,frame2>Step back in history</a>
should go back in the iframes you desire.
__________________
Free Logo's Guarantee:
Not satisfied with your logo?
Claim 100% of your money back!
Reply With Quote
  #5 (permalink)  
Old 09-16-2009, 06:59 AM
Junior Member
 
Join Date: Sep 2009
Posts: 3
maryjohn is on a distinguished road
Default problem on javascript onclick event

Hey dear..

My advise to u just u should change some code what ever u write,
just put action in the form tag like

<form action=".. ">
..
..
..
</form>

just try it
Reply With Quote
Reply

Thread Tools
Display Modes

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 On
Pingbacks are On
Refbacks are On



All times are GMT. The time now is 11:59 AM.



mouseover mouseover mouseover