473,388 Members | 946 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,388 software developers and data experts.

Combining Two Scripts


Hello!

I came across two different scripts [mouseover and opening the new pag
in a sized window] that I wanted to combine, and I thought I wa
successful until I discovered a minor glitch.

What was happening was that the page that was linked to came out fine
but the page where the link was was linking out to another page [tryin
to direct to the site in my code].
Here's what my code looks like.
<html>
<head>
<!--
This file retrieved from the JS-Examples archives
http://www.js-examples.com
1000s of free ready to use scripts, tutorials, forums.
Author: JS-Examples - http://www.js-examples.com/
-->

</head>
<body>
<a href="Value="Open Window
ONCLICK="window.open('http://www.geocities.com/taintedrhapsody/tainted.html'
'Sample', 'width=600,height=600')" onmouseover='switchImages("on")
onmouseout='switchImages("off")'><img name="imagename" src="taintx.gif
border="0"></a>
<script>// This creates an image object.
var preloadedImage1 = new Image();// This tells the web browser t
download this image now (rather than later).
preloadedImage1.src="taint.gif";
// This creates an image object also.
var preloadedImage2 = new Image();// This tells the web browser t
download this image now (rather than later).
preloadedImage2.src="taintx.gif";
function switchImages(_onOff) {
if (_onOff=="on")// This replaces the image in the objec
"preloadedImage" and puts
// a copy into the document image object that was defined up above/
with the "img" tag.
document.imagename.src=preloadedImage1.src;
else
document.imagename.src=preloadedImage2.src;

}
</script>
</body>
</html>
What I want my page to do is:
1. The image that links to my main page have a mouseover effect.
2. Have my main page open in the sized window without error.
3. Have the page with the image NOT link or try to open a differen
site.

If someone could help me, I'd be really grateful

Unregistered
-----------------------------------------------------------------------
Posted via http://www.forum4designers.co
-----------------------------------------------------------------------
View this thread: http://www.forum4designers.com/message34382.htm

Jul 20 '05 #1
3 1447
Unregistered hu kiteb:
Hello!

I came across two different scripts [mouseover and opening the new
page in a sized window] that I wanted to combine, and I thought I was
successful until I discovered a minor glitch.

What was happening was that the page that was linked to came out fine,
but the page where the link was was linking out to another page
[trying to direct to the site in my code].
Here's what my code looks like.
Can you clarify that? A new browser window was opened, but it contained
the same page as the original page? Is that right?
<html>
<head>
<!--
This file retrieved from the JS-Examples archives
http://www.js-examples.com
1000s of free ready to use scripts, tutorials, forums.
Author: JS-Examples - http://www.js-examples.com/
One point: Ther are often problems when combining two pre-made scripts
on the same page without editing them. Common problems include variables
and functions with the same name. It is better to learn at least enough
to understand how the stuff you c&p works than to just copy it blindly.

Looking at your stuff below, I notice that the line breaking is a
complete mess. I'm not sure if this is a deliberate attempt to make it
hard to read, or if it is accident, or if it i an artifact of the
website you posted from.
</head>
<body>
<a href="Value="Open Window"
Change that to

href=#

Thats still not the ideal solution acording to everyone on this list,
but it should leave you on the same page, and won't necessarily result
in an error. I'm curious. Did the original code for your javascripts say
to put that in the href attribute?
ONCLICK="window.open('http://www.geocities.com/taintedrhapsody/tainted.h
tml', 'Sample', 'width=600,height=600')" onmouseover='switchImages("on")'
onmouseout='switchImages("off")'><img name="imagename"
src="taintx.gif" border="0"></a>


The script tags should appear before any calls to that script appear. At
the point where you have " onmouseover='switchImages("on")' ", the page
does not yet know that a switchImages() function even exists. This would
result in an error in a strict interpretation.

[snip code]

--
Fabian
This post is not associated in any way with forum4designers dot com.
Permission is specifically denied for that website to archive this post
or display it in any way.

Jul 20 '05 #2

I know that the whole script was confusing, but I'm not the greatest a
scripts, and I've only taught myself to tweak minor things in th
scripts. What I do is only out of trial and error so I'm not certai
on the changes I make.

Through your reply, I did manage to fix the problem, so I just wante
to say thanks

Unregistered
-----------------------------------------------------------------------
Posted via http://www.forum4designers.co
-----------------------------------------------------------------------
View this thread: http://www.forum4designers.com/message34382.htm

Jul 20 '05 #3
JRS: In article <bu************@ID-174912.news.uni-berlin.de>, seen in
news:comp.lang.javascript, Fabian <la****@hotmail.com> posted at Mon, 19
Jan 2004 14:49:08 :-

Looking at your stuff below, I notice that the line breaking is a
complete mess. I'm not sure if this is a deliberate attempt to make it
hard to read, or if it is accident, or if it i an artifact of the
website you posted from.


AIUI, it is the website.

It has no business connecting to this Usenet newsgroup, and moreover is
evidently badly designed.

Those who wish to have questions answered in a Usenet newsgroup should
post them to that group using appropriate software.

--
John Stockton, Surrey, UK. ?@merlyn.demon.co.uk Turnpike v4.00 MIME.
Web <URL:http://www.merlyn.demon.co.uk/> - FAQish topics, acronyms, & links.
For news:borland.*, use their server newsgroups.borland.com ; but first read
Guidelines <URL:http://www.borland.com/newsgroups/guide.html> ff. with care.
Jul 20 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

27
by: Mxsmanic | last post by:
How can I combine SSI, CGI, and PHP in Apache 2.x? I keep reading that this can be done, but I haven't found any examples of the actual configuration required to do it. What I want to do is: ...
2
by: Brian | last post by:
Hi All, Can someone please point me in the right direction I am having problems combining JS and ASP. What I am trying to do is store in a database using ASP the referring page of my visitors. ...
2
by: Chris Mullins | last post by:
I've spent a bit of time over the last year trying to implement RFC 3454 (Preparation of Internationalized Strings, aka 'StringPrep'). This RFC is also a dependency for RFC 3491...
7
by: Barry | last post by:
Hi all, I've noticed a strange error on my website. When I print a capital letter P with a dot above, using & #7766; it appears correctly, but when I use P& #0775 it doesn't. The following...
0
by: Edge | last post by:
I have two scripts I'd like to combine together. One is the Directory on my site listing profiles for bands, labels, promoters etc. The other script I have is a blogger that I would like to place...
3
by: Roger | last post by:
Hi there I have several bigger applications programmed with the old ASP (vbscript). A lot of data is stored in the session object. Now I have to extend the application with new functionality...
2
by: peteinglastonbury | last post by:
I'd be most grateful if someone would help me. I hope I'm in the right forum (apologies if not) - I'm not sure whether my problem is CGI or Javascript related. I found a script called...
5
by: Tristan Miller | last post by:
Greetings. Is it possible using HTML and CSS to represent a combining diacritical mark in a different style from the letter it modifies? For example, say I want to render ő (Latin small letter...
3
by: Mike Gleason jr Couturier | last post by:
Hi, I want to reduce the number of scripts (js) the client has to download . If I'm using validators and some other stuff, The page have 5-6 dynamic scripts.. Is it possible to tell the...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.