Hello I wonder if it's possible because I've done the example of a sidebar in the google script tutorial I've put a link to google website when we click a tab is opened with the google search
My question is it would be possible to click and have the google page search in the sidebar and do a search right there? Thank you.
<!DOCTYPE html>
<html>
<head>
<base target="_top">
</head>
<body>
Click here for a google search
<input type="button" value="Ferme"
onclick="google.script.host.close()" />
</body>
</html>
This script will take the search phrase from the input box and open a new tab with the results:
<!DOCTYPE html>
<html>
<head>
<base target="_top">
<script>
function doSearch() {
var searchFor = document.getElementById("txtSearchFor").value;
window.open("https://www.google.com/search?q=" + searchFor);
}
</script>
</head>
<body>
<H1>Sidebar</H1>
<input type="text" id="txtSearchFor"/>
<input type="button" value="Search" id="btnSearch" onclick="doSearch()"/>
</body>
</html>
If you want to actually do something with the results then you should look at using the google custom search api which is a bit more involved.
Related
I know that the code below will go to the result page of google when the user types some texts and the submit button is clicked.
<!DOCTYPE html>
<html lang="en">
<head>
<title>
Hello!
</title>
</head>
<body>
<form action="https://www.google.com/search" method="get">
<input name="q" type="text">
<input type="submit" value="Submit Form">
</form>
</body>
</html>
But I try this with https://www.jitta.com/. It does not seem to have the same structure as google.
When searching on this website the url will be https://www.jitta.com/stock/bkk:ptt where "ptt" is the word that I want to search. Unlike google, if I want to search "ptt" the url will be https://www.google.com/search?q=ptt.
Can it be only HTML code? no other parts involved (like Javascript,...)
Appreciate anyone who answers this.
I am trying to create a simple google plus post page that take text from text box and when click on google sharing button text will be posted automatically. Here is my code I am using.
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>HTML Forms</title>
</head>
<body>
<form>
<div>
<label for="example">Let's submit some text</label>
<input id="example" type="text" name="text">
</div>
<div>
<g:plus action="share"></g:plus>
<script >
window.___gcfg = {
lang: 'zh-CN',
parsetags: 'onload'
};
</script>
<script src="https://apis.google.com/js/client:platform.js" async defer></script>
</div>
</form>
</body>
</html>
Its a simple html page. I use form submit option. I am beginner, so I am not exactly getting why it did not take text from text box.
The only configurable content attribute for the Google+ share button is data-href and it goes directly on <g:plus action="share" data-href="https:/example.com"></g:plus>. The only other configuration the share button supports is for how it will be displayed.
The Google+ share button only supports sharing URLs and does not support sharing text.
You could try using interactive posts but they require a lot more setup and a call to action.
I have an HTML file that has several links to the same URL. Is there a way to specify the URL once, instead of in each anchor? Currently, if I change the URL, I manually change it in each anchor. I would consider a Javascript solution, but would prefer something a bit simpler and lightweight. Here is a code sample with two links to google.com:
<HTML>
<HEAD>
</HEAD>
<BODY>
<P>
Preferred search engine
</P>
<HR>
<P>
Google
</P>
</BODY>
</HTML>
You can use the <base> element:
For example:
<!DOCTYPE html>
<html>
<head>
<meta content="text/html; charset=utf-8" http-equiv="Content-Type">
<title>Untitled 1</title>
<base href="https://www.google.com/">
</head>
<body>
<p>
Preferred search engine
</p>
Google
</p>
</body>
</html>
Any links you specicfy will be relative to the base URL, so if you had Preferred search engine the link would be https://www.google.com/foo.html
You have to use javascript to do that. jQuery will do nicely:
$(function() {
$('a').attr('href','https://www.google.com');
});
Then you can call the same thing if the URL changed.
If you don't want to use jQuery this is the equivalent js code:
<script>
function ChangeHref(){
document.getElementById("a").setAttribute("onclick", "location.href='https://www.google.com'");
}
</script>
You cal trigger the changehref from anywhere you want.
BTW: the above function is equal to document.ready.
How would you do this with form ()?
Make a text box and a Submit button.
You type anything in the textbox and Submit will open a website in your browser with a link of: (example) test.com/TextTheyPutHere.
Basically, if I put 'lol' in the textbox, it would open a website test.com/lol.
Please help.
Try this:
<!DOCTYPE html>
<html>
<head>
<script>
function newDoc() {
window.location.assign("http://www.yourVeryOwnSitez.com/"+document.myForm.myDestination.value)
}
</script>
</head>
<body>
<form method="post" name="myForm">
<input type="text" name="myDestination">
<input type="button" value="Gogogo" onclick="newDoc()">
</form>
</body>
</html>
Then edit line 7 and put your particular url in the place of "www.yourVeryOwnSitez.com".
This is driving me crazy....
I'm trying to get TinyMCE v4.0.6 to work, and I'm probably doing something very dumb, since I can't get the editor to display at all.
I could get a v3.5.8 editor to show in a page similar to what follows, but no joy with this:
<!DOCTYPE html>
<html>
<head>
<title>TinyMCE Test</title>
<meta http-equiv="content-type" content="text/html; charset=utf-8"/>
<script type="text/javascript" src="tinymce/tinymce.min.js"></script>
<script type="text/javascript">
tinymce.init({
selector: "textarea"
});
</script>
</head>
<body>
<form method="post" action="something">
<textarea name="content" cols="100" rows="15">content</textarea>
<input type="submit" value="Save" />
</form>
</body>
</html>
I've verified (using FireBug) that the path to the tinymce JavaScript file is correct, but other than that, I'm completely at a loss.
Thanks for any suggestions..
After your comment, I took your HTML and checked it with a CDN copy of tinyMCE and it work fine: http://codepen.io/anon/pen/mIvFg so I can only assume it's an error with your tinymce.min.js file.