Code Bank
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
 
User Name:
Password:
Remember me
Go Back   ASP Free ForumsProgrammingCode Bank

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread ASP Free Forums Sponsor:
  #1  
Old April 5th, 2005, 04:17 PM
speedy33417 speedy33417 is offline
Contributing User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Feb 2005
Posts: 70 speedy33417 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 21 h 10 m 44 sec
Reputation Power: 4
Putting it all together

Let me start with saying that I'm new to JavaScript. I'm trying to add a link to my web page. It should open a new window with no toolbar, scrollbar, location, etc.

I have the following pieces that I can't put together:



Code:

 
<script type="text/javascript">
 
function open_win()
 
{
 
window.open(http://www.mysite.com","my_window","toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=no, resizable=no, copyhistory=no")
 
}
 
</script>
 




Code:

 
<a target="_blank" href="http://www.mysite.com/"><font size="2" color="#000080"><b>Click here</b></font></a>
 




As you can see I’m having trouble merging JavaScript with HTML.

Reply With Quote
  #2  
Old April 5th, 2005, 05:10 PM
Phoenix's Avatar
Phoenix Phoenix is offline
Web-Standards Evangelist
ASP Free Intermediate (1500 - 1999 posts)
 
Join Date: Nov 2003
Posts: 1,522 Phoenix User rank is Corporal (100 - 500 Reputation Level)Phoenix User rank is Corporal (100 - 500 Reputation Level)Phoenix User rank is Corporal (100 - 500 Reputation Level)Phoenix User rank is Corporal (100 - 500 Reputation Level) 
Time spent in forums: 4 Days 23 h 48 m 4 sec
Reputation Power: 8
Quote:
Originally Posted by speedy33417
As you can see I’m having trouble merging JavaScript with HTML.


Nah.... easy mistake to make when you've got syntax highlighting off... you haven't enquoted the function arguments properly:

Thus:

Code:
 <script type="text/javascript">
  
 function open_win() {
  
 window.open("http://www.mysite.com","my_window","toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=no, resizable=no, copyhistory=no")
  
 }
  
 </script>
 


Oh, and it helps to use the latest XHTML for the other bit:

Code:
 linkclassnamegoeshere { size: small; color: #008; font-weight: bold; text-decoration: underline; cursor: hand; }
 
 <span class="linkclassnamegoeshere" onclick="open_win()">Click here</span>
 

Reply With Quote
  #3  
Old April 5th, 2005, 05:39 PM
banker's Avatar
banker banker is offline
Charging Rhino Wizard
ASP Free Regular (2000 - 2499 posts)
 
Join Date: Dec 2004
Location: 127.0.0.1
Posts: 2,053 banker User rank is Sergeant Major (2000 - 5000 Reputation Level)banker User rank is Sergeant Major (2000 - 5000 Reputation Level)banker User rank is Sergeant Major (2000 - 5000 Reputation Level)banker User rank is Sergeant Major (2000 - 5000 Reputation Level)banker User rank is Sergeant Major (2000 - 5000 Reputation Level)banker User rank is Sergeant Major (2000 - 5000 Reputation Level) 
Time spent in forums: 5 Days 23 h 28 m 28 sec
Reputation Power: 36
don't forget the "." when defining your class!
Code:
.linkclassnamegoeshere { size: small; color: #008; font-weight: bold; text-decoration: underline; cursor: hand; }
__________________
ShepherdWeb :: Charging Rhino Wizard

I know of no more encouraging fact than the unquestionable ability of man to elevate his life by conscious endeavor.
{Henry David Thoreau}

§ shepherdweb.com
§ fariswheel productions
§ reagan administration

Reply With Quote
  #4  
Old April 5th, 2005, 08:30 PM
speedy33417 speedy33417 is offline
Contributing User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Feb 2005
Posts: 70 speedy33417 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 21 h 10 m 44 sec
Reputation Power: 4
Thanks. Got it working. Just out of curiosity, how would I change the cursor to hand without defining a class? Is it possible to do it in the same line with onclick?
Right now this is what I have:
Code:
<script type="text/javascript">
function open_win()
{
window.open("http://www.mysite.com","something","toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=no, resizable=no, copyhistory=no")
}
</script>
<style>
<!--
.myclass { cursor: hand; }
-->
</style>

And…
Code:
<span class="myclass" onclick="open_win()"><img border="0" src="button.gif" width="75" height="15"></span>

Reply With Quote
  #5  
Old April 6th, 2005, 02:36 AM
nofriends's Avatar
nofriends nofriends is offline
Senior Water Wizard
ASP Free God 11th Plane (10000 - 10499 posts)
 
Join Date: Aug 2004
Location: Cape Town, RSA
Posts: 10,186 nofriends User rank is Brigadier General (60000 - 70000 Reputation Level)nofriends User rank is Brigadier General (60000 - 70000 Reputation Level)nofriends User rank is Brigadier General (60000 - 70000 Reputation Level)nofriends User rank is Brigadier General (60000 - 70000 Reputation Level)nofriends User rank is Brigadier General (60000 - 70000 Reputation Level)nofriends User rank is Brigadier General (60000 - 70000 Reputation Level)nofriends User rank is Brigadier General (60000 - 70000 Reputation Level)nofriends User rank is Brigadier General (60000 - 70000 Reputation Level)nofriends User rank is Brigadier General (60000 - 70000 Reputation Level)nofriends User rank is Brigadier General (60000 - 70000 Reputation Level)nofriends User rank is Brigadier General (60000 - 70000 Reputation Level)nofriends User rank is Brigadier General (60000 - 70000 Reputation Level)nofriends User rank is Brigadier General (60000 - 70000 Reputation Level)  Folding Points: 101990 Folding Title: Super Ultimate Folder - Level 1Folding Points: 101990 Folding Title: Super Ultimate Folder - Level 1Folding Points: 101990 Folding Title: Super Ultimate Folder - Level 1Folding Points: 101990 Folding Title: Super Ultimate Folder - Level 1Folding Points: 101990 Folding Title: Super Ultimate Folder - Level 1Folding Points: 101990 Folding Title: Super Ultimate Folder - Level 1
Time spent in forums: 3 Months 2 Weeks 2 Days 7 h 36 m 24 sec
Reputation Power: 699
hi,

you could use it like this

Code:
<span style="cursor:hand" onclick="open_win()"><img border="0" src="button.gif" width="75" height="15">


but the advice you got here, is the best way to do it.
Comments on this post
banker agrees: you are correct sir!
__________________
Look! Its a ShemZilla



Reply With Quote
Reply

Viewing: ASP Free ForumsProgrammingCode Bank > Putting it all together


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 6 hosted by Hostway
Stay green...Green IT