Solved

Javascript Code to open a new web page

Posted on 2013-06-23
5
477 Views
Last Modified: 2013-06-24
I am trying out Embarcadero's HTML5 Builder, and want to have a two-screen mobile application. I can write a button which calls a Javascript function.

It is a simple question, but I can't figure out what to put in the (simple) one-line command to open the second screen.
0
Comment
Question by:GrahamDLovell
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
5 Comments
 
LVL 6

Expert Comment

by:Vijay Pratap Singh
ID: 39270448
<a href="javascript:;" onclick="window.location = 'http://example.com/submit.php?url=' + escape(document.location.href);'">Go</a>;
0
 

Author Comment

by:GrahamDLovell
ID: 39270548
This is standard javascript code for an onclick event.

My problem is with the HTML5 Embarcadero IDE, and here I need a call embedded in a function. Sorry that I wasn't clearer.

The example code for a Hello Word app, which refreshes the screen label when you click on MButton, and supply an input name (in the field Edit1), looks like this:

function MButton1Click(event) {
$('#MLabel1').html("Hello, " + $('#MEdit1').val() + "!");
}

Some of this syntax is understandable, eg. ("Hello, " + $('#MEdit1').val() + "!"), but rest is a total mystery. I have never come across this before.
0
 
LVL 57

Expert Comment

by:Julian Hansen
ID: 39270895
The rest is JQuery

What it is saying is

$('#MLabel1') gets a reference to the MLable1 element as a JQuery object.

Once you have this you can call the .html method on that object which basically sets the innerHTML of the element so the line basically does this

Set the html content of the element identified by MLabel1 to the string Hello concatenated with the Value of the input element with id MEdit1

In terms of showing the other screen - is this a completely new page or a simulated "new screen" i.e. a hidden div that is then displayed on some event?
0
 

Author Comment

by:GrahamDLovell
ID: 39271395
Good explanation. Thanks for the direction. I will read up on JQuery.

I was planning that the other screen just be a completely new page that I will pre-prepare.
0
 
LVL 57

Accepted Solution

by:
Julian Hansen earned 500 total points
ID: 39272131
Then you could do something like this.

function MButton1Click(event) {
    window.location = "urlofnewpage.html";
}
0

Featured Post

Raise the IQ of Your IT Alerts

From IT major incidents to manufacturing line slowdowns, every business process generates insights that need to reach the people required to take action. You need a platform that integrates with your business tools to create fully enabled DevOps toolchains.

You need xMatters.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Building a website can seem like a daunting task to the uninitiated but it really only requires knowledge of two basic languages: HTML and CSS.
This article discusses four methods for overlaying images in a container on a web page
In this tutorial viewers will learn how to embed Flash content in a webpage using HTML5. Ensure your DOCTYPE declaration is set to HTML5: "<!DOCTYPE html>": Use the <object> tag to embed Flash content.: To specify that the object is Flash content, d…
In this fifth video of the Xpdf series, we discuss and demonstrate the PDFdetach utility, which is able to list and, more importantly, extract attachments that are embedded in PDF files. It does this via a command line interface, making it suitable …

717 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question