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.
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.
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.
I have a database front-end that has several text fields for input on top of the page using post, and a pagination bar at the bottom of the page that uses the post method as well.
I've encapsulated the top inputs in
<form method = 'post'>
<Body>
//Inputs
//Table contents
//Pagination bar buttons
</Body>
</Form>
, but I've also extended the form so the form extends to the bottom of the document. (Database table is returned in middle of document) If I start a new form tag, the request will not include the previously entered text fields on the top, only the input inside the bottom form, so I can't use two forms.
<Html>
<Form method ='post'>
//Inputs
</Form>
//Table results
<Form method = 'post'>
//Pagination bar buttons
</Form>
</Html>
This will not work.
I want to ask, is it ok to encapsulate entire html doc in form tag? I don't want the client to send the entire doc in post or something.
If you mean this, that's fine:
<!DOCTYPE html>
<html>
<head>
<title>This is OK</title>
</head>
<body>
<form>
Everything
</form>
</body>
</html>
But
<form>
<!DOCTYPE html>
<html>
<head>
<title>Yes this is bad</title>
</head>
<body>
Something
</body>
</html>
</form>
or
<!DOCTYPE html>
<form>
<html>
<head>
<title>Yes this is bad</title>
</head>
<body>
Something
</body>
</html>
</form>
Is just invalid.
The only thing(s) that will be submitted in a form are values associated with input tags. So the entire document won't be submitted in the form. Only values associated with inputs.
Whether or not your design is "a bad idea" is hard to tell with the information given. I am unable to tell why exactly your pagination bar needs to be a form at all (rather than a link) but again, if you're worried about the entire document submitting in the form, that won't happen.
I'm working on an existing page. And there's a button on the page. It's like:
<html>
<script src="..."></script>
...
<div><input>...</input></div>
</html>
After click the button, a pop up dialog page(it's a fully functional page, not just displaying some messages) will show. It's like:
<html>
<script src="..."></script>
...
<div><input>...</input></div>
<div>
<iframe>
<html>
<script src="..."></script>
<form>
...
</form>
</html>
</iframe>
</div>
</html>
In the new page, I have to load all the necessary script again which takes a lot of time.
My question is:
I'm doubtful about this kind of implementation, can someone comment on this?
what's the best practice for this kind of scenario(open a new dialog page)?
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".