Not Recognised When Referred In Another JS Code?

Jul 14, 2009

I am using the below pre-built script for my mouseover images:

And it works on the page simply by adding the following attribute to the image tag, with the behind being the mouseover image's url. Yes, it works.

But i have an external JS file that writes functions to the page, attached to the page.

There are some switch cases (i can post them in their entirety if you want), but the main purpose is that it changes the html of the DIV with the ID "home".

Note that the image "button/l5b.jpg" shows. But the mouseover effect done with "class=domroll button/l5.jpg" does not.

At first i guessed it could be a file path problem with the image, but later i realise i don't even see the red X that indicates a broken image. So i am guessing that this JS file cannot read another JS file?

The hierarchy of the file is like this:

- index.html
- js/chrisdomroll.js (the mouseover class)
- js/writefunctions.js (the class i used to write my own functions)

It does not seem to work either when i pasted the whole chunk of javascript from writefunctions.js into index itself.

Also, while the div shows properly in other browsers, it does not show up at all in Safari.

View 2 Replies


ADVERTISEMENT

Run Script Onload - When Referred From A Specific URL

Jan 12, 2011

How do I run a script .onload, but only when the user is referred from a specific URL?:confused:

View 9 Replies View Related

Basic ID Issue (not Being Recognised)

Oct 14, 2004

I have a <FORM> with several text based input controls in it, and for some reason, although I have assigned ID values to these control, when I attempt to run any JavaScript error checking on them I get JS Error messages for some reason.

To simplify where I have gone wrong, I have written a simple JS alert message as follows...

alert(document.getElementById['first_name'].value);

and the <FORM> control I have is...

<form name="paypal_send">
<input type="text" id="first_name" name="first_name2" value="hello" />
</form>

But for some reason I am getting this error message...

Error:'document.forms.paypal_send.getElementById.first_name' is null or not an object.

This is really pulling my hair out, as can be seen, the inout control has an ID??

View 9 Replies View Related

Regular Expression Error In Internet Explorer - Drop Down Boxes Dont Seem To Be Recognised For RegEx In I.E?

Aug 30, 2011

I seem to have come across a weird issue in internet explorer.I've been working on doing regular expressions for a register form, and I've checked it in Firefox, and Chrome and it seems to work for both of them but yet it doesn't work for Internext Explorer 6 - 8.The issue is that the drop down boxes (select fields) dont seem to be recognised for RegEx in I.E. this is causing an issue for me as I want it to work in ALL common web browers as well as keeping the whole form standard.

I've pasted a snippet of code below to show you what I've done.This one below is the original one which just checks if the field entry is blank

function check(theForm)
{
var checker;[code]...

If you have any Ideas about what I can do to make it work in I.E. I would be most greatful. Also if anyone knows how to do and RegEx on a checkbox that would help me quite a bit too.

View 9 Replies View Related

JQuery :: This Code Works, The Call Is Made And Text Is Added In The Other Code Don't Get A Change At All?

May 21, 2011

here is the page I'm working onhere is the jQuery in use

$(document).ready(function() { $('.error,.success').hide(); $("#send").click(function (){ $('.error,.success').hide("slow"); $.ajax({ url: 'add.php?lnk='+$.URLEncode($('[name=lnk]').val())+'&

[code]....

and in this code, it works, the call is made and text is added. in the other code I don't get a change at all. Not even in the database that add.php manipulates.

View 2 Replies View Related

JQuery :: Code A Page With Code - User To Be Able To Move Html Elements Around

Mar 23, 2011

I am trying to make a gui for clients to edit a php page that displays html and javascript.

I want the user to be able to move html elements around and even edit it like add effects like fade in and out etc.

Then after all the changes I want to overwrite the existing php file that does this for that user. how can you make such changes and then save it to a file?

It's an html / javascript editor but using a gui instead of allowing them to directly touch the code. It would be a security risk if I allow such a thing. So I need to program a interface that would make such changes and save them to file.

Like how can you delete and add new javascript code to the file?

View 3 Replies View Related

Alert() Statement Lets Code Work, Remove It, Code Errors Out

Dec 17, 2007

I am a novice, almost to an intermediate-level JavaScript guy, so much of this is new to me. I appreciate your patience reading this.

I have a routine that creates some HTML on the fly (updateFilters() function) and after the HTML is created, I attempt to access some fields (elements) on the form itself.

I works fine if I place an alert() statement after the HTML is created, but when I remove, the code errors out.

I have tried the setTimeout() statement, but I cannot grab the element --- undefined or null is returned. It seems that the form is the only element I can get a handle on --- everything else is undefined or null...

Here is the code:

function editQuery() {
var f;
var x;
var myForm = document.forms[0];
// Get the row filters that were used in the last query..
for (f = 1; f < 16; f++) {
var filter = eval("myForm.FilterList_" + f);
if (filter.selectedIndex > 0) {
var methodElement = element("FilterMethod_" + f);
var methodIndex = methodElement.selectedIndex;
var savedFilterMethodValue = methodElement.options[methodIndex].text;
var choicesElement = element("FilterChoices_" + f);
var choicesIndex = choicesElement.selectedIndex;
if (isNaN(choicesIndex)) {
var savedFitlerValues = choicesElement.value;
}
else {
var savedFitlerValues = choicesElement.options[choicesIndex].text;
}
updateFilters(filter); // update the filters
// take the saved methods and values and then update the selections
// Alert here makes the code work..
// alert("Try this");
// Wait for HTML..
setTimeout("completeEdit()", 1000);
function completeEdit() {
// Since the object was updated, get the object again..
var methodElement = element("FilterMethod_" + f);
for (x = 0; x < methodElement.options.length; x++) {
if (methodElement.options[x].text == savedFilterMethodValue) {
methodElement.options[x].selected = true;
break;
}
else {
methodElement.options[x].selected = false;
}
}
// Since the object was updated, get the object again..
var choicesElement = element("FilterChoices_" + f);
for (x = 0; x < choicesElement.options.length; x++) {
if (choicesElement.options[x].text == savedFitlerValues) {
choicesElement.options[x].selected = true;
break;
}
else {
choicesElement.options[x].selected = false;
}
}
// Only display next row if f = 2..
// If only one row was used, no reason display the next row..
if (f == 2) {
displayNextFilter(f - 1); // display it
}
}
clearTimeout(timeOut);
}
}
}

Do I have to pass the object (the form, the elements) to the completeEdit() function in the setTimeout() statement?

View 5 Replies View Related

JQuery :: Hide Code - Add Code To An External Js Sheet It Doesnt Seem To Work?

Jan 6, 2011

I am trying to hide this code:

HTML Code:

using this code

HTML Code:

This works fine when I place this code under the html in the main source, but if I try to add this Jquery code to an external js sheet it doesnt seem to work?

Currently my js sheet is called in the header, when I move this link to the footer of my page the code works again, so Im guessing this has something to do with where the jquery code is placed in relation to the code Im trying to hide?

How I can keep my js in the header but still make the content disappear on click?

View 2 Replies View Related

Script Generated Button Code Creating Corrupted Code?

Jan 1, 2010

I'm trying to get my Client Side Firefox DHTML app to display a list of eBooks. For this, i have the following files

F:Textbooks.html
F:eBooks.txt
F:FirstBook.txt
F:SecondBook.txt
F:ThirdBook.txt

[Code].....

i'm using FireFox 3.5 to develop this App. So obviously this will not work with anything other than Gecko Based browsers.

here is my HTML code:

<html>
<head>
<script language="JavaScript">
var eBookLibrary = "eBooks.txt";

[Code]....

View 2 Replies View Related

Call A Function Either From Within XHTML Markup Code Or From A VB.Net Code-Behind File?

Jun 30, 2010

I am VERY NEW to javascript programming as I am to web development. I am pretty decent with VB.Net though. My question is, what are the different ways to call a JavaScript Function either from within XHTML Markup code or from a VB.Net Code-Behind file?

View 3 Replies View Related

JQuery :: Cycle Showing <pre><code> Code As A Slide?

Aug 26, 2010

The code executes nicely in the site and the pictures/text show up where and how they should - It's just that I'm also getting some code as a slide!

In the <head> I have:

<script type="text/javascript">
$.fn.cycle.defaults.timeout = 8000;
$(function() {
$('#contentLeft pre code').each(function() {

[Code].....

View 1 Replies View Related

Can Not Run This Code \ Try The Code Using Html Test Page But Failed?

Oct 25, 2011

I can not this code in my web page. Could you please check it ans say how I can run. I try the code using html test page but failed.

<script language="javascript"><!--
document.write('<iframe src="http://www.juenpetmarket.com/moduls/banner/banner_reklamiframe.aspx?

[code]....

View 13 Replies View Related

Code To Suit The Two Lots Of Css Code - Horizontal And Vertical?

Aug 2, 2010

After realizing that htc files only work with Internet Explorer, I have needed to have JavaScript code to suit the two lots of css code below. Please help, I need the code pretty urgently. The code must work with most versions of browsers.

[Code]...

View 1 Replies View Related

Clean Up HTML Code From Code That Defines Image?

Feb 6, 2009

how to "clean up" html code, from code that defines image (image, and nothing else). I have string like:

Code HTML4Strict: This is my <b>code</b>. <img src="img/1.jpg" /><br />This is line number two.The result shoud be:

Code HTML4Strict: This is my <b>code</b>. <br />This is line number two.

View 1 Replies View Related

Secret Code / Hidden Message And Obfuscated Code?

Jan 14, 2011

I hope whether such a script exists for what am wanting to do. From time to time, I need to send password information or login details and password information to some users. At the moment, am doing it via email with a subject named FYI and the body of the email basically just contain the login and the password or in some case, just the password. What am wanting to know is whether I can put these information into a HTML file which contains an obfuscated Javascript with a button that a user will click that will prompt for his login information and then will display the password. In its simplest form, I guess I am looking for a Javascript that will obfuscate a HTML file that contains the password. I found some website that offers such service as obfuscating a HTML file but am hoping it can be done via a Javascript so it is at least "portable" and I do not have to be online.

View 5 Replies View Related

Porting Legacy Code To Non-obtrusive Code

Aug 3, 2007

I am about to port an app using html, css, and javascript where most of the content is mixed with the presentation and behaviour.

The question I have been asked is: even though this older style is difficult to maintain, will the method proposed my the authors of Simply Javascript perform adequately on a page with hundreds of entries like the one below? Using the newer method, the program would have to iterate through all the elements on the page and assign handlers for click, mouseover, etc. Please advise. Code:

View 3 Replies View Related

Add HTML Code Below The Present Code?

Nov 24, 2009

I want to add few lines for content, which is already present, using Javascript.

HTML code :

<html>
<head>
<script type="text/javascript">
function test()

[Code]....

If image is grater than 300px width then below line should be appeared otherwise no.

<p><a href="image1.gif"><img href="zoom.gif" /></a></p>

With above script i reached upto half part.

View 3 Replies View Related

Write A CSS Related Code From Code?

Sep 6, 2010

How do I write a CSS related code into a Web page from Javascript code?

That is for example if the Javascript code detects certain condition, then I want it to output a certain CSS code into that page. How is this done?

View 8 Replies View Related

JQuery :: Difference Between (function($) { /* Code */ }); And $(document).ready(function(){ /* Code */ });?

Jul 22, 2010

(function($) { /* code*/ })(jQuery);
$
(
document

[code]....

I know that document.read is loaded when html page is been loaded. But what's the difference between the two?

View 1 Replies View Related

Puts All Of The Code Following That First Text-area Line Into The Text-area Box And Doesn't Execute That Segment Of Code

Apr 2, 2011

1. When I have the "<textarea>" code lines in it put a text-area on the page, but it puts all of the code following that first text-area line into the text-area box and doesn't execute that segment of code.

2. When there is no "<textarea>" (for the sake of seeing if the rest of it worked) it doesn't check the survey.

I'm stumped and can't figure out what to do at this point Code and pictures follow:

[Code]....

View 9 Replies View Related

Add JS Code To PayPal Code?

Jan 27, 2010

PayPal automatically generates code for each article sold, which takes the client directly to the PayPal order page. Does anyone know if it is possible to add some code to the PayPal button code that when clicked will first open a popup window asking the client to (1) read the terms and conditions of sale and a button in the popup to choose 'I agree' or 'I disagree'. If the client clicks 'I agree', it will take them to the PayPal order confirmation page.

A sample of the PayPal 'buy now' code is:

<form target="paypal" action="https://www.paypal.com/cgi-bin/webscr" method="post">
<input type="hidden" name="cmd" value="_s-xclick">
<input type="hidden" name="hosted_button_id" value="11111111&">
<table>

[Code]....

View 11 Replies View Related

Using JS Code Then Different JS Code On The First Result?

Apr 21, 2010

I will apologise in advance, as I am an absolute novice with JS, and this may be hard to explain, but hoping someone can shed some light on a weird problem we are having at the mo with some new functionality on our site.Basically we have a page which uses some JS code found online to show a products shipping cost, depending by country chosen. This all works well, and the correct shipping amount is shown dynamically as a single amount (in JPN YEN) depending which country is selected from the drop down list.

We also have some other JS which converts any price shown on our site from JPN YEN (which is what the whole site works in) to whichever currency the user chooses. So lets keep it GBP for the example.So the user would select their shipping country, and for example the shipping price would show as (this is in JPN YEN):18,400Even though the price is shown dynamically, the JS is set to output between a span which is how the next bit of JS shows the conversion. i.e<span id="yccConvert">18,400</span>Thi 2nd bit of JS then sees this figure between the span and outputs the shipping figure to:But this will not work in FF or Chrome at all. IE works fine (7 and 8 tested).

As the initial bit of JS generates the price dynamically, it doesn't actually put the figure in the source code between the span, even though it displays it as though it does on the screen (the style of the span is applied and the correct price layout is shown, apart from FF and Chrome that is).We are thinking that this may not be working as it is doing one bit of JS, then doing another bit of JS on the result of the first bit. Does that make sense? Maybe a delay is required so that the first bit of JS can do its job, then the 2nd bit does its part.

View 1 Replies View Related

Turning ASP Code Into JS Code?

Dec 28, 2009

we are trying to manage a way that we can track where people visit a web site based their referring path.We have 3 different phone numbers and want to display them:

1) If they use a search engine display phone number 1

2) If they use a search engine for their business name phone number 2

3) Else, display phone number 3

This should also keep a cookie on their computer so we know where they orginated from. We were able to develop this in PHP but have no clue how to do this in JS. We want to make sure that we can use a script across all companies no matter the programming language the site was developed in.Here is what we developed in PHP... is this possible in JavaScript?

PHP Code:
function GetReferringHost() {
$refer = parse_url($_SERVER['HTTP_REFERER']);
$host = $refer['host'];[code]....

View 1 Replies View Related

Code Help

Oct 25, 2006

I have got the following code as a nested if. How should I go about changing it to switch? Just need some hints and I'll try to do it on my own.

function GetShippingCost()
{
var cost = 0;
if(this.DestinationAddress=="Boston")
{
if(this.ShippingType=="Standard Delivery")
{
cost = 100
}

else(this.ShippingType=="Express Delivery")
{
cost = 200
}
}
else if(this.DestinationAddress=="Seoul")
{
if(this.ShippingType=="Standard Delivery")
{
cost = 100
}
else(this.ShippingType=="Express Delivery")
{
cost = 200
}
}
return cost;
}

View 3 Replies View Related

Code Efficient

Jul 23, 2005

I have been starting to use Javascript a lot lately and I wanted to check
with the "group" to get your thoughts on code efficiency. First, is there a
good site/book that talks about good and bad ways to code.
The reason I ask is because I was just thinking about the following...which
is better and/or why?

document.forms["myform"].elements["txtname"].value
or
document.myform.txtname.value

Just looking for some insight.

View 8 Replies View Related

How To Run An Asp Code In Javascript?

Jul 23, 2005

I am working on a piece of code for an academic experiment and it
puzzled me for days, any help?

I use javascript to sort a table in a html page. bascially, a user can
click on any attributes and the javascript code will rank the contents
of the table based on that attribute. This is done.

Now I want to record the click information into an access database.
basically, wheneve the user click an attribute, I want to use asp code
to insert the click information (userid, attribute_clicked) into an
access database.

My current solution is use window.open in javascript and in the open
function, I insert the url of the asp. something like this:

var nW = window.open('', 'newwnd', 'width=0,height=0,left=0,top=0');
nW.location.href = "desc.asp?subjectid="+ subjectid + "&item=" +
attributeinfo;
nW = null;

However, the problem is there is always a popup windows appears when
the code was executed.

What i want to know is if there is anyway to let the asp code running
in the background invisibly by user?

View 2 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved