Can't Get Html Page Call Js Function

May 28, 2010

how to call my js function on the HTML page. This is a homework assignment and I've written the code but I just can't make it work. I can get the prompt boxes but the results don't show.

The assignment is to calculate basketball ticket prices. Each ticket has a base price. An up-charge or down-charge % is applied to the base price depending on the seat location. Courtside seats command a 20% premium upcharge Lower bowl seats have a 12% premium upcharge Inexpensive upper bowl seats cost 5% less than the stated base ticket price. If more than 8 tickets are purchased, 5% will be deducted from the total.

I have to use prompt() in my html page to prompt user for information. Then I'm to call the function to calculate the answers and build HTML to ouput.

look at what I have and offer advice as how to fix my code.

Here's my js file:
function calcTotalTicketCost(baseTicketCost, totalNumberTickets){
var courtside = 0.20;
var lowerbowl = 0.12;

[Code]....

View 4 Replies


ADVERTISEMENT

Call A Function Multiple Times In The Same Html Page?

Dec 5, 2010

I cannot call a function more than one time in my page, the function is:

Code:
<script>
function seeBig(_this) {
document.all.view_img.src=_this.parentNode.getElementsByTagName("img")[0].src;
}

[Code]....

what problem I am facing is, if I want to build another table as the same as the one above, the function will not work. I know I might need give the function an ID

View 1 Replies View Related

Call Script Function From Iframe.html To Control An Object On Index.html?

Aug 25, 2010

I'm building a webpage using javascript and iframes. Basically I have an iframe in the middle of the index.html page that links to another html page (let's call it iframe.html). My question is, is it possible to call a javascript function from iframe.html to control an object on index.html? If so, how do I do this? I'd like to be able to assign an image in iframe.html with the hyperlink of href="javascript:function()", where the function effects the CSS of a div on index.html.

View 2 Replies View Related

JQuery :: Call Back Function - Should The 1st Parameter Of The Get Function Be A HTML File

Jun 23, 2010

I have just started learning JQuery and have a doubt in the below code. $.get('myhtmlpage.html', myCallBack);The doubt is should the 1st parameter of the get function be a HTML file or can it be a unction name?

View 1 Replies View Related

Problem With Html Page Using Cached Page In Window.open(url) Call

Jul 20, 2005

I have an html page that uses javascript to open a new window and
display a file that gets created when a button is pressed.

My problem is when the file is changed and the display button is
pressed, the old file is still displaying. I have tried using

<META HTTP-EQUIV=expires CONTENT=0><META HTTP-EQUIV=PRAGMA CONTENT=NO-CACHE>, but doesn't work 100% of the time.

View 1 Replies View Related

Call Function In .js From Html File?

May 14, 2010

how can I call function located in java script file from html file . also I have many java scripts file connected to my html file .

View 6 Replies View Related

Is It Possible To Call A Js Function In Another Html File Without Switching

Jul 20, 2005

is it possible to call a js function in another html file (without switching/showing that file)?

View 1 Replies View Related

Save Function In Html Or Php File And Call It In Other Php Applications?

Jun 17, 2009

i am making website, every thing is great i even learned php and sql, But i made input info validation in javascript, and i have a lot of same pages, i know in php i can use include("***.php"); and echo sprintf("%'09s", $***); to launch a php code from other file, can i do it in javascript and how? i want to save my javascript function in html or php file and call it in other php aplications, is it possible?

View 2 Replies View Related

Call A Js Function From A Test.js Located In A HTML File

Jul 28, 2011

I'm trying to call a Js function from a test.js located in a HTML file.

I'm getting error message "Object has no method..." in Chrome. But no issues are seen in Firefox.

<html>
<head>
<div>

[Code]...

View 3 Replies View Related

Insert Counter Call In External Script Instead Of HTML Page

Mar 5, 2011

I actually use a counter on a webpage (It works). To do it, I use an inline javascript but I would like to unify the entire page and call that counter directly in the external Javascript that manages the whole site.

Here's the actual code...
Code:
HTML
<body onLoad=gen_hits()>
...
<span id='hits'></span><SCRIPT language="JavaScript" SRC="[URL]"></SCRIPT>
...
</body>

EXTERNAL JAVASCRIPT (ini.js)
var hits="HITS ";
function gen_hits() {
document.getElementById("hits").innerHTML=hits;
}

And here a "view" of my request...
Code:
HTML
<body onLoad=gen_hits()>
...
<span id='hits'></span>
...
</body>

EXTERNAL JAVASCRIPT
var hits="HITS " + <SCRIPT language="JavaScript" SRC="[URL]"></SCRIPT>;
function gen_hits() {
document.getElementById("hits").innerHTML=hits;
}
How to modify it ?

View 5 Replies View Related

Call A Function That Is In Another Page?

Nov 8, 2009

I have tow page and the first page open a new window with javascript(by using window.open).Now I want to call a javascript function that is in the first page from the second page and for that i use parent.function_name but it doesn't work.How can do so?

View 5 Replies View Related

Call Function In Web Page?

Mar 13, 2010

How to call javascript function in a web page?e.g. Putting the following code alert('test');in a web page will display the string "alert('test');".No alert box appears.

View 1 Replies View Related

Call Function In .aspx Page?

Jan 6, 2009

i have a function test() in a external js file i want to call it in my .aspx page how do i call it i tries using dim dv= externalfile.getfilters() ealier my function was in the same page and hence wrking fine dv= getfilters()

View 2 Replies View Related

JQuery :: Call The Same Function Two Times In The Same Page?

May 22, 2011

I need to call the same function two times in the same page. So instead of doing this:

$("button").click(function(){
instructions.....
});

[code]....

If yes, what is the correct syntax, then? because what i posted here does not work.

View 1 Replies View Related

JQuery :: Call A IFrame Page Function

Apr 24, 2011

I have three pages and let me explain through the sample.

page1 : index.html

Code:

page2 : screens.html

Code:

page3 : controller.js

Code:

I am running the index.html and not getting the content of controller.js -> myFunction().

But if I put a breakpoint using FireBug in Mozilla Browser at the beginning of $(document).ready(function(){,

Then the myFunction is called and working fine. How to run the index.html without breakpoint and get the iframe content.

View 1 Replies View Related

Ajax :: Call Function From Page Thats Been Called?

Jan 30, 2010

like theres two pages.page one calls page two and displays the output of page 2 on page 1 via ajax.now can i click on page 2's output(on page one) and have it execute another javascript function to call AJAX(a third page)

View 1 Replies View Related

JQuery :: Call Function After Page Load In Iframe?

Apr 23, 2009

My iframe id is 'bpd'. I would like to call a function after the page loads into the iframe.

Here is my code and I am getting 'Invalid Argument' error.

$('#bpd').load('/main/buspd.cfm', function () {
setHeight();
});

View 4 Replies View Related

JQuery :: Call Resize Function Once After Page Loads?

Jul 7, 2010

I've ran into a little problem when using resize() function in jQuery as I am trying to call a function after the document loads and later on should window resize occur, but I can't really figure out use jQuery syntax to do the both at the same time within a function.

Here's a example:
$(document).ready(function() {
doScript();
$(window).resize(function doScript() {
// do stuff
});
});
So it is possible to give an instance name to this (resize) function and call it just once after the page loads?

View 2 Replies View Related

Ajax :: First Function Call On Page Load Always Skipped

Oct 9, 2010

Trying to call the same Ajax function twice on initial load of the page, but only the second one executed. I try to load mainpage, and inside mainpage I try to use ajax to load content1.asp to div1 and content2.asp to div2.

Test scenario (based on the Situation below):
- Page loaded, 1st ajax function skipped, 2nd ajax function loaded
- Remarked 1st ajax function, then 2nd ajax function loaded
- Remarked 2nd ajax function, then 1st ajax function loaded
- Moved the 2nd ajax function to above 1st ajax function, the 2nd ajax function is skipped.

Conclusion:
- the 1st ajax function always skipped. But Why? How to ensure both ajax is called upon loading of the page?

Situation:
mainpage.asp
<div id="div1"></div>
<div id="div2"></div>
<script language="JavaScript1.2">
ajax('div1', 'GET', 'page1.asp');
ajax('div2', 'GET', 'page2.asp');
</script>

ajax.js -
function ajax(strDivID, strMethod, strURL){
if (window.XMLHttpRequest)
{// code for IE7+, Firefox, Chrome, Opera, Safari
xmlhttp=new XMLHttpRequest();
}else
{// code for IE6, IE5
xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
}xmlhttp.onreadystatechange=function(){
if (xmlhttp.readyState==4 && xmlhttp.status==200){
document.getElementById(strDivID).innerHTML=xmlhttp.responseText;
}}
xmlhttp.open(strMethod,strURL,true);
if (strMethod="POST"){
xmlhttp.setRequestHeader("Content-type","application/x-www-form-urlencoded");
}xmlhttp.send();
}

View 1 Replies View Related

Onclick Function Call Only Works One Time On A Page?

Oct 18, 2011

I have a web page a lot of thumbnail images arranged in a table. I would like the user to be able to click on the thumbnail to open a window with a larger view of the image.

So I wrote a JS function to accept a URL as the argument and open a new pop-up window with the given parameters. I need this function to potentially run multiple times from multiple links (in this case images) on the same page. However, after the first time I click the link, the function runs, and I close the pop-up, the function will not run again if I click the same or another link on the page. If I refresh the page, the function will work once and then not again. Is there a buffer I need to clear or something to reset to allow multiple links to work?

I have tried the function call in a whole slew of ways. Here's my current code (I "..."'ed out the URLs for brevity):

<script type="text/javascript">
function zoomWindow(url)
{
zoomWindow=window.open(url,"", "toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=yes, resizable=no, copyhistory=no, height=645px, width=550px");

[Code]....

View 2 Replies View Related

Creating Menu Link That Opens New Page And Call Function

Jun 21, 2011

I would like to include drop-down navigation links on my home page that connect to other pages on my website. No problem there. The problem is that some of the other pages contain a series of div elements that are hidden (display:none) until activated by javascript enabled links on the page. Clicking those links changes some of the page's content (within a div) .. almost like a "new" page. [URL]. Here's my question: Is there any way to create menu links on my home page that will open the "concert.html" page AND display the appropriate div content at the same time?
For example: on the home page, a menu link under "Concert" that opens that page and automatically displays the "Rock Symphonies" section?

Here are the related HTML div elements on the "concert.html" page:
<div id="page1">concept content</div>
<div id="page2" style="display:none;">rock symphonies content</div>
<div id="page3" style="display:none;">general program content</div>
<div id="page4" style="display:none;">ticket price content</div>
<div id="page5" style="display:none;">concert committee content</div>

Here are the corresponding js-enabled links:
<li><a href="javascript:page(1,5);" id="tag1">Concept</a></li>
<li><a href="javascript:page(2,5);" id="tag2">Rock Symphonies</a></li>
<li><a href="javascript:page(3,5);" id="tag3">General Program</a></li>
<li><a href="javascript:page(4,5);" id="tag4">Ticket Prices</a></li>
<li><a href="javascript:page(5,5);" id="tag5">Concert Committee</a></li>

And here's the javascript I'm using: (scripts/generator.js)
function page(id,all) {for (i=1; i<=all; i++) { if (i==id) {
document.getElementById('page'+i).style.display="inline";
document.getElementById('tag'+i).style.fontWeight="normal";
document.getElementById('tag'+i).style.color="#FFF"; }
else {
document.getElementById('page'+i).style.display="none";
document.getElementById('tag'+i).style.fontWeight="normal";
document.getElementById('tag'+i).style.color="#a4bfed";} }}

View 2 Replies View Related

JQuery :: Call A Plugin Function From A Html File In Which The Plugin Is Running

Aug 18, 2011

I have a slideshow plugin and there is a function in it called stopAutoplay(). This is called when I click on the pre-defined pause button in the slideshow, so it stops.

If I switch between the slideshows(Slideshow 1 2 3) the slideshow is getting messier and messier because it starts many slideshows at the same time and the plugin gets confused what to show.

I figured if I click on the pause button before I switch to another slideshow it works fine. Therefore what I would like to achieve now is to call stopAutoplay() somehow before I switch to the new slides.

How can I call stopAutoplay() from the html file when I click on one of the slideshow 1 2 3 buttons?

I've tried the codes in green below but they don't work.

fadeSlideShow(); plugin pause function part:
stopAutoplay = function(){
clearInterval(intval);
intval = false;

[Code]....

If there is a better solution let's say to kill everything before the new slideshow appears it's even better. Although I've tried die(), empty(), detach(), remove(). I hoped remove() would help cause as I read it's suppsed to remove everything but for some reasons it doesn't...

View 3 Replies View Related

Iframe Inside A Page - Function Call Is Not Working In Safari And Google Chrome?

Jan 2, 2009

i have an iframe inside a page(main). In that iframe, i am calling a java script function that is in the main page.This function call is working in Mozilla , IE but not in Safari and google chrome?? Is there any specific reason for that? when i add the function in the iframe it works.

View 2 Replies View Related

Function Call With Quotes Inside Another Function Call?

Feb 11, 2006

<button onClick="return popup('<span onClick='selectShape(1, 1, 1)'>test<span>');" tabindex=&#393;' onFocus="setFocusColor(0,3)">....</button>
This will work perfectly, but as soon as I need to pass Strings inside the selectShape function, I get stuck.

So the question is, how can I create the following and have it working

......selectShape(2, 'Tricky', &#3940;x5°').....

View 1 Replies View Related

Putting A Comment Function Into Html/css Page

Jan 19, 2011

I have not been able to do any JS because my damn books have been on order for the last 3 weeks put a script into my webpage so that when anybody visits the 'contact us' page they can leave comments.

Here's my code:

HTML:

<!DOCTYPE html "PUBLIC-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>

[Code].....

I know this doesn't validate but it's only a draft site until I get my books.

Here's the page, I want the comment underneath all three div's.

View 1 Replies View Related

Manually Executing A Function In An HTML Page?

Nov 3, 2009

Is it possible to execute a JS function in a website, by using the JS console? Facebook has a function Facebook.streamPublish() for instance, which displays a dialog box to send a story to your Wall.Is it possible to call this from the JS console manually?I'm developing a Facebook application. I tried to call the above function from the Firebug console to test but with no success.

View 4 Replies View Related







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